import * as React from 'react'
import { Drawer } from 'antd'
import SiderMenu from './SiderMenu'

export interface Props{
  collapsed: boolean
  isMobile: boolean
  menuData: Array<any>
  location?: any
  onCollapse: (flag: boolean) => void
}
const SiderMenuWrapper = (props: Props) => {
  const { isMobile, collapsed } = props;
  return isMobile ? (
    <Drawer
      visible={!collapsed}
      placement="left"
      style={{
        padding: 0,
      }}
      onClose={() => {
        props.onCollapse(true)
      }}
    >
      <SiderMenu {...props} collapsed={isMobile ? false : collapsed} />
    </Drawer>
  ) : (
    <SiderMenu {...props} />
  );
}
export default SiderMenuWrapper